
#define BLINKER_PRINT Serial
#define BLINKER_WIFI

#include <Blinker.h>

#define PIN 2

char auth[] = "ac7970254ad3"; //上一步中在app中获取到的Secret Key
// char auth[] = "06b0b46288be"; //上一步中在app中获取到的Secret Key
char ssid[] = "Xiaomi 12S"; //您的WiFi热点名称
char pswd[] = "wangxiangkai"; //您的WiFi密码

BlinkerButton Button("btn");

void btn_callback(const String & state) {
    BLINKER_LOG("get button state: ", state);
    digitalWrite(PIN, !digitalRead(PIN));
}

void setup() {
// 初始化串口
  Serial.begin(115200);

  // 初始化有LED的IO
  pinMode(PIN, OUTPUT);
  digitalWrite(PIN, LOW);
  // 初始化blinker
  Blinker.begin(auth, ssid, pswd);
  Button.attach(btn_callback);

}

void loop() {
  // put your main code here, to run repeatedly:
  Blinker.run();

}
